﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;

namespace DAO
{
    public class DAO_Email_NhanKM
    {
        public bool ThemEmailKM(string Email, string Thanhpho)
        {
            string query = "Insert into EMAIL_NHAN_KM values ('" + Email + "','" + Thanhpho + "');";
            try
            {
                DataProvider.ExecuteQuery(query);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }

        public bool KiemTraTonTaiEmail(string Email)
        {
            string query = "Select Email from EMAIL_NHAN_KM where Email = '" + Email + "';";
            try
            {
                DataTable dt = DataProvider.ExecuteQuery(query);
                if (dt.Rows.Count == 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                return false;
            }
        }
    }
}
